


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
  <title>Coverage Report :: Dormancy</title>
  <style type="text/css">
    @import "../../.css/coverage.css";
  </style>
</head>

<body>
<div class="header"></div>

<div class="content">
<div class="breadCrumbs">
    [ <a href="../../index.html">all classes</a> ]
    [ <a href="../index.html">at.dormancy</a> ]
</div>

<h1>Coverage Summary for Class: Dormancy (at.dormancy)</h1>

<table class="coverageStats">
<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Class, %
</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">Dormancy</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/ 1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    90.5%
  </span>
  <span class="absValue">
    (19/ 21)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    90%
  </span>
  <span class="absValue">
    (188/ 209)
  </span>
</td>
</tr>

</table>

<br/>
<br/>


<div class="sourceCode"><i>1</i>&nbsp;/*
<i>2</i>&nbsp; * Copyright 2013 Gregor Schauer
<i>3</i>&nbsp; *
<i>4</i>&nbsp; * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<i>5</i>&nbsp; * you may not use this file except in compliance with the License.
<i>6</i>&nbsp; * You may obtain a copy of the License at
<i>7</i>&nbsp; *
<i>8</i>&nbsp; *      http://www.apache.org/licenses/LICENSE-2.0
<i>9</i>&nbsp; *
<i>10</i>&nbsp; * Unless required by applicable law or agreed to in writing, software
<i>11</i>&nbsp; * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
<i>12</i>&nbsp; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<i>13</i>&nbsp; * See the License for the specific language governing permissions and
<i>14</i>&nbsp; * limitations under the License.
<i>15</i>&nbsp; */
<i>16</i>&nbsp;package at.dormancy;
<i>17</i>&nbsp;
<i>18</i>&nbsp;import at.dormancy.persistence.PersistenceUnitProvider;
<i>19</i>&nbsp;import at.dormancy.persister.*;
<i>20</i>&nbsp;import at.dormancy.persister.callback.EntityCallback;
<i>21</i>&nbsp;import at.dormancy.util.AbstractDormancyUtils;
<i>22</i>&nbsp;import at.dormancy.util.ClassLookup;
<i>23</i>&nbsp;import org.apache.commons.collections.CollectionUtils;
<i>24</i>&nbsp;import org.apache.commons.lang.ArrayUtils;
<i>25</i>&nbsp;import org.apache.commons.lang.exception.ExceptionUtils;
<i>26</i>&nbsp;import org.apache.commons.lang.reflect.ConstructorUtils;
<i>27</i>&nbsp;import org.apache.log4j.Level;
<i>28</i>&nbsp;import org.apache.log4j.Logger;
<i>29</i>&nbsp;import org.springframework.aop.support.AopUtils;
<i>30</i>&nbsp;import org.springframework.beans.BeanUtils;
<i>31</i>&nbsp;import org.springframework.beans.BeansException;
<i>32</i>&nbsp;import org.springframework.beans.PropertyAccessor;
<i>33</i>&nbsp;import org.springframework.context.ApplicationContext;
<i>34</i>&nbsp;import org.springframework.context.ApplicationContextAware;
<i>35</i>&nbsp;import org.springframework.core.CollectionFactory;
<i>36</i>&nbsp;import org.springframework.util.ClassUtils;
<i>37</i>&nbsp;import org.springframework.util.ObjectUtils;
<i>38</i>&nbsp;
<i>39</i>&nbsp;import javax.annotation.Nonnull;
<i>40</i>&nbsp;import javax.annotation.Nullable;
<i>41</i>&nbsp;import javax.annotation.PostConstruct;
<i>42</i>&nbsp;import javax.inject.Inject;
<i>43</i>&nbsp;import java.io.Serializable;
<i>44</i>&nbsp;import java.lang.reflect.Constructor;
<i>45</i>&nbsp;import java.util.Collection;
<i>46</i>&nbsp;import java.util.ConcurrentModificationException;
<i>47</i>&nbsp;import java.util.LinkedHashMap;
<i>48</i>&nbsp;import java.util.Map;
<i>49</i>&nbsp;
<i>50</i>&nbsp;/**
<i>51</i>&nbsp; * Clones Hibernate entities and merges them into a persistence context.&lt;br/&gt;
<i>52</i>&nbsp; *
<i>53</i>&nbsp; * @author Gregor Schauer
<i>54</i>&nbsp; * @see EntityPersister
<i>55</i>&nbsp; */
<i>56</i>&nbsp;public class Dormancy&lt;PU, PC, PMD&gt; extends AbstractEntityPersister&lt;Object&gt; implements ApplicationContextAware {
<b class="fc"><i>57</i>&nbsp;	protected static final Logger logger = Logger.getLogger(Dormancy.class);</b>
<i>58</i>&nbsp;	protected Map&lt;Class&lt;?&gt;, AbstractEntityPersister&lt;?&gt;&gt; persisterMap;
<i>59</i>&nbsp;	protected PersistenceUnitProvider&lt;PU, PC, PMD&gt; persistenceUnitProvider;
<i>60</i>&nbsp;	protected EntityPersisterConfiguration config;
<i>61</i>&nbsp;	protected AbstractDormancyUtils&lt;PU, PC, PMD, PersistenceUnitProvider&lt;PU, PC, PMD&gt;&gt; utils;
<b class="fc"><i>62</i>&nbsp;	protected boolean registerDefaultEntityPersisters = true;</b>
<i>63</i>&nbsp;
<i>64</i>&nbsp;	@Inject
<b class="fc"><i>65</i>&nbsp;	public Dormancy(PersistenceUnitProvider&lt;PU, PC, PMD&gt; persistenceUnitProvider) {</b>
<b class="fc"><i>66</i>&nbsp;		this.persistenceUnitProvider = persistenceUnitProvider;</b>
<b class="fc"><i>67</i>&nbsp;	}</b>
<i>68</i>&nbsp;
<i>69</i>&nbsp;	/**
<i>70</i>&nbsp;	 * Initializes this instance.&lt;br/&gt;
<i>71</i>&nbsp;	 * If no {@link EntityPersisterConfiguration} is set, a default configuration is created.
<i>72</i>&nbsp;	 */
<i>73</i>&nbsp;	@PostConstruct
<i>74</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>75</i>&nbsp;	public void initialize() {
<i>76</i>&nbsp;		// Initialize JPA provider specific DormancyUtils
<b class="fc"><i>77</i>&nbsp;		if (utils == null) {</b>
<b class="fc"><i>78</i>&nbsp;			String className = &quot;at.dormancy.util.DormancyUtils&quot;;</b>
<b class="fc"><i>79</i>&nbsp;			Class&lt;?&gt; type = ClassLookup.find(className).orThrow(</b>
<i>80</i>&nbsp;					&quot;Cannot initialize Dormancy: Missing class \&quot;%s\&quot;\n&quot; +
<i>81</i>&nbsp;							&quot;Please make sure that there is exactly one Dormancy backend in the classpath.\n&quot; +
<i>82</i>&nbsp;							&quot;Official implementations are:\n&quot; +
<i>83</i>&nbsp;							&quot;x) hibernate3\n&quot; +
<i>84</i>&nbsp;							&quot;x) hibernate4\n&quot; +
<i>85</i>&nbsp;							&quot;x) jpa-hibernate\n&quot; +
<i>86</i>&nbsp;							&quot;x) jpa-eclipselink\n&quot;, className).get();
<i>87</i>&nbsp;
<b class="fc"><i>88</i>&nbsp;			Constructor&lt;? extends AbstractDormancyUtils&gt; ctor = ConstructorUtils.getAccessibleConstructor(</b>
<i>89</i>&nbsp;					type, persistenceUnitProvider.getClass());
<b class="fc"><i>90</i>&nbsp;			utils = BeanUtils.instantiateClass(ctor, persistenceUnitProvider);</b>
<i>91</i>&nbsp;		}
<i>92</i>&nbsp;
<i>93</i>&nbsp;		// Ensure that a configuration is provided
<b class="fc"><i>94</i>&nbsp;		if (config == null) {</b>
<b class="nc"><i>95</i>&nbsp;			config = new EntityPersisterConfiguration();</b>
<i>96</i>&nbsp;		}
<i>97</i>&nbsp;
<i>98</i>&nbsp;		// Register all default entity persisters if necessary
<b class="fc"><i>99</i>&nbsp;		if (registerDefaultEntityPersisters) {</b>
<b class="fc"><i>100</i>&nbsp;			addEntityPersister(ArrayPersister.class);</b>
<b class="fc"><i>101</i>&nbsp;			addEntityPersister(CollectionPersister.class);</b>
<b class="fc"><i>102</i>&nbsp;			addEntityPersister(MapPersister.class);</b>
<b class="fc"><i>103</i>&nbsp;			addEntityPersister(NoOpPersister.class);</b>
<i>104</i>&nbsp;		}
<b class="fc"><i>105</i>&nbsp;	}</b>
<i>106</i>&nbsp;
<i>107</i>&nbsp;	@Nullable
<i>108</i>&nbsp;	@Override
<i>109</i>&nbsp;	public final &lt;T&gt; T clone(@Nullable T dbObj) {
<b class="fc"><i>110</i>&nbsp;		return clone_(dbObj, createAdjacencyMap());</b>
<i>111</i>&nbsp;	}
<i>112</i>&nbsp;
<i>113</i>&nbsp;	@Nullable
<i>114</i>&nbsp;	@Override
<i>115</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>116</i>&nbsp;	public &lt;T&gt; T clone_(@Nullable T dbObj, @Nonnull Map&lt;Object, Object&gt; tree) {
<i>117</i>&nbsp;		// Check if the object has already been processed
<b class="fc"><i>118</i>&nbsp;		if (tree.containsKey(dbObj) || dbObj == null) {</b>
<b class="fc"><i>119</i>&nbsp;			return (T) tree.get(dbObj);</b>
<i>120</i>&nbsp;		}
<i>121</i>&nbsp;
<i>122</i>&nbsp;		// Use an EntityPersister if possible
<b class="fc"><i>123</i>&nbsp;		AbstractEntityPersister&lt;T&gt; entityPersister = getEntityPersister((Class&lt;T&gt;) dbObj.getClass());</b>
<b class="fc"><i>124</i>&nbsp;		if (entityPersister != null) {</b>
<b class="fc"><i>125</i>&nbsp;			if (logger.isDebugEnabled()) {</b>
<b class="fc"><i>126</i>&nbsp;				logger.debug(String.format(&quot;Using %s for %s&quot;, entityPersister.getClass().getSimpleName(), dbObj));</b>
<b class="fc"><i>127</i>&nbsp;				if (logger.isTraceEnabled()) {</b>
<i>128</i>&nbsp;					try {
<b class="fc"><i>129</i>&nbsp;						logger.trace(org.apache.commons.beanutils.BeanUtils.describe(dbObj));</b>
<b class="fc"><i>130</i>&nbsp;					} catch (Exception e) {</b>
<i>131</i>&nbsp;						// ignore
<b class="fc"><i>132</i>&nbsp;					}</b>
<i>133</i>&nbsp;				}
<i>134</i>&nbsp;			}
<b class="fc"><i>135</i>&nbsp;			return entityPersister.clone_(dbObj, tree);</b>
<i>136</i>&nbsp;		}
<i>137</i>&nbsp;
<i>138</i>&nbsp;		// Create a new instance of the same type
<b class="fc"><i>139</i>&nbsp;		T trObj = config.getCloneObjects() || utils.isJavassistProxy(dbObj.getClass()) ? (T) BeanUtils.instantiateClass(utils.getClass(dbObj)) : dbObj;</b>
<i>140</i>&nbsp;
<i>141</i>&nbsp;		// Add the object to the adjacency list
<b class="fc"><i>142</i>&nbsp;		tree.put(dbObj, trObj);</b>
<i>143</i>&nbsp;
<i>144</i>&nbsp;		// If automatic flushing is enabled, flush the persistence context to make sure that there are no pending changes
<b class="fc"><i>145</i>&nbsp;		if (config.getFlushAutomatically()) {</b>
<b class="nc"><i>146</i>&nbsp;			utils.flush();</b>
<i>147</i>&nbsp;		}
<i>148</i>&nbsp;
<i>149</i>&nbsp;		// Retrieve the Hibernate class metadata (if available)
<b class="fc"><i>150</i>&nbsp;		PMD metadata = utils.getMetadata(dbObj);</b>
<i>151</i>&nbsp;
<i>152</i>&nbsp;		// Process the properties
<b class="fc"><i>153</i>&nbsp;		String[] propertyNames = utils.getPropertyNames(dbObj);</b>
<i>154</i>&nbsp;		PropertyAccessor dbPropertyAccessor;
<i>155</i>&nbsp;		try {
<b class="fc"><i>156</i>&nbsp;			dbPropertyAccessor = utils.getPropertyAccessor(metadata, dbObj);</b>
<b class="fc"><i>157</i>&nbsp;		} catch (Exception e) {</b>
<b class="fc"><i>158</i>&nbsp;			logger.warn(String.format(&quot;Cannot access object %s: %s&quot;, ObjectUtils.identityToString(dbObj), ExceptionUtils.getMessage(e)));</b>
<b class="fc"><i>159</i>&nbsp;			tree.put(dbObj, null);</b>
<b class="fc"><i>160</i>&nbsp;			return null;</b>
<b class="fc"><i>161</i>&nbsp;		}</b>
<b class="fc"><i>162</i>&nbsp;		PropertyAccessor trPropertyAccessor = dbObj == trObj ? dbPropertyAccessor : utils.getPropertyAccessor(metadata, trObj);</b>
<b class="fc"><i>163</i>&nbsp;		for (String propertyName : propertyNames) {</b>
<b class="fc"><i>164</i>&nbsp;			if (utils.isTransient(dbObj, propertyName)) {</b>
<b class="fc"><i>165</i>&nbsp;				continue;</b>
<i>166</i>&nbsp;			}
<i>167</i>&nbsp;
<i>168</i>&nbsp;			Object dbValue;
<i>169</i>&nbsp;			try {
<b class="fc"><i>170</i>&nbsp;				dbValue = dbPropertyAccessor.getPropertyValue(propertyName);</b>
<b class="fc"><i>171</i>&nbsp;			} catch (BeansException e) {</b>
<b class="fc"><i>172</i>&nbsp;				if (metadata != null) {</b>
<i>173</i>&nbsp;					/**
<i>174</i>&nbsp;					 * If the property value cannot bet read and the object is a Hibernate entity, throw an exception.
<i>175</i>&nbsp;					 * Note that this is a security mechanism to ensure database consistency.
<i>176</i>&nbsp;					 * Otherwise it would be possible that references, which are not initialized properly,
<i>177</i>&nbsp;					 * cause constraint violations or even delete associations.
<i>178</i>&nbsp;					 */
<b class="fc"><i>179</i>&nbsp;					throw e;</b>
<b class="nc"><i>180</i>&nbsp;				} else if (logger.isDebugEnabled()) {</b>
<i>181</i>&nbsp;					// If the property value of a non entity cannot be read, write a debug message to the log.
<b class="nc"><i>182</i>&nbsp;					logger.debug(ExceptionUtils.getMessage(e));</b>
<i>183</i>&nbsp;				}
<b class="nc"><i>184</i>&nbsp;				continue;</b>
<b class="fc"><i>185</i>&nbsp;			}</b>
<i>186</i>&nbsp;
<b class="fc"><i>187</i>&nbsp;			Object trValue = null;</b>
<i>188</i>&nbsp;			// If the property (e.g., a lazy persistent collection) is initialized traverse the object graph recursively
<b class="fc"><i>189</i>&nbsp;			if (dbValue != null) {</b>
<b class="fc"><i>190</i>&nbsp;				if (utils.isInitialized(dbValue)) {</b>
<b class="fc"><i>191</i>&nbsp;					trValue = clone_((T) dbValue, tree);</b>
<b class="fc"><i>192</i>&nbsp;				} else if (utils.isPersistentCollection(dbValue) &amp;&amp; config.getCreateEmptyCollections()) {</b>
<b class="fc"><i>193</i>&nbsp;					trValue = dbValue instanceof Map</b>
<i>194</i>&nbsp;							? CollectionFactory.createApproximateMap(dbValue, 0)
<i>195</i>&nbsp;							: CollectionFactory.createApproximateCollection(dbValue, 0);
<i>196</i>&nbsp;				}
<i>197</i>&nbsp;			}
<i>198</i>&nbsp;
<b class="fc"><i>199</i>&nbsp;			if (logger.isTraceEnabled()) {</b>
<b class="fc"><i>200</i>&nbsp;				logger.trace(String.format(&quot;Setting property %s of %s to %s&quot;, propertyName, trObj, trValue));</b>
<i>201</i>&nbsp;			}
<i>202</i>&nbsp;
<i>203</i>&nbsp;			// Attempt to set the property value
<i>204</i>&nbsp;			try {
<b class="fc"><i>205</i>&nbsp;				trPropertyAccessor.setPropertyValue(propertyName, trValue);</b>
<b class="fc"><i>206</i>&nbsp;			} catch (BeansException e) {</b>
<b class="fc"><i>207</i>&nbsp;				if (metadata != null) {</b>
<i>208</i>&nbsp;					/**
<i>209</i>&nbsp;					 * If the property value cannot bet set and the object is a Hibernate entity, throw an exception.
<i>210</i>&nbsp;					 * Note that this is a security mechanism to ensure database consistency.
<i>211</i>&nbsp;					 * Otherwise it would be possible that references, which are not initialized properly,
<i>212</i>&nbsp;					 * cause constraint violations or even delete associations.
<i>213</i>&nbsp;					 */
<b class="fc"><i>214</i>&nbsp;					throw e;</b>
<b class="nc"><i>215</i>&nbsp;				} else if (logger.isEnabledFor(Level.WARN)) {</b>
<i>216</i>&nbsp;					// If the property value of a non entity cannot be set, write a warning to the log.
<b class="nc"><i>217</i>&nbsp;					logger.warn(ExceptionUtils.getMessage(e));</b>
<i>218</i>&nbsp;				}
<b class="fc"><i>219</i>&nbsp;			}</b>
<i>220</i>&nbsp;		}
<i>221</i>&nbsp;
<b class="fc"><i>222</i>&nbsp;		return trObj;</b>
<i>223</i>&nbsp;	}
<i>224</i>&nbsp;
<i>225</i>&nbsp;	@Nullable
<i>226</i>&nbsp;	@Override
<i>227</i>&nbsp;	public final &lt;T&gt; T merge(@Nullable T trObj) {
<b class="fc"><i>228</i>&nbsp;		return merge_(trObj, createAdjacencyMap());</b>
<i>229</i>&nbsp;	}
<i>230</i>&nbsp;
<i>231</i>&nbsp;	@Nullable
<i>232</i>&nbsp;	@Override
<i>233</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>234</i>&nbsp;	public &lt;T&gt; T merge_(@Nullable T trObj, @Nonnull Map&lt;Object, Object&gt; tree) {
<i>235</i>&nbsp;		// Check if the object has already been processed
<b class="fc"><i>236</i>&nbsp;		if (tree.containsKey(trObj) || trObj == null) {</b>
<b class="fc"><i>237</i>&nbsp;			return (T) tree.get(trObj);</b>
<i>238</i>&nbsp;		}
<i>239</i>&nbsp;
<i>240</i>&nbsp;		// Use a EntityPersister if possible
<b class="fc"><i>241</i>&nbsp;		AbstractEntityPersister&lt;T&gt; entityPersister = getEntityPersister((Class&lt;? extends T&gt;) trObj.getClass());</b>
<b class="fc"><i>242</i>&nbsp;		if (entityPersister != null) {</b>
<b class="fc"><i>243</i>&nbsp;			if (logger.isDebugEnabled()) {</b>
<b class="fc"><i>244</i>&nbsp;				logger.debug(String.format(&quot;Using %s for %s&quot;, entityPersister.getClass().getSimpleName(), trObj));</b>
<i>245</i>&nbsp;			}
<b class="fc"><i>246</i>&nbsp;			return entityPersister.merge_(trObj, tree);</b>
<i>247</i>&nbsp;		}
<i>248</i>&nbsp;
<i>249</i>&nbsp;		// Verify that the given object is a non-null managed entity.
<b class="fc"><i>250</i>&nbsp;		PMD metadata = utils.getMetadata(trObj);</b>
<b class="fc"><i>251</i>&nbsp;		if (metadata == null) {</b>
<b class="fc"><i>252</i>&nbsp;			return trObj;</b>
<i>253</i>&nbsp;		}
<i>254</i>&nbsp;
<i>255</i>&nbsp;		// Retrieve the identifier of the persistent object
<b class="fc"><i>256</i>&nbsp;		Serializable identifier = utils.getIdentifier(metadata, trObj);</b>
<i>257</i>&nbsp;
<i>258</i>&nbsp;		// If the identifier cannot be retrieved via getter, try to access it directly.
<b class="fc"><i>259</i>&nbsp;		if (identifier == null) {</b>
<i>260</i>&nbsp;			// If the object has no identifier, it is considered to be new
<b class="fc"><i>261</i>&nbsp;			if (config.getSaveNewEntities()) {</b>
<i>262</i>&nbsp;				// If desired, try to persist the object
<b class="fc"><i>263</i>&nbsp;				utils.persist(trObj);</b>
<b class="fc"><i>264</i>&nbsp;				identifier = utils.getIdentifier(metadata, trObj);</b>
<i>265</i>&nbsp;			} else {
<i>266</i>&nbsp;				// Otherwise throw an exception indicating that the entity should have be saved before
<b class="fc"><i>267</i>&nbsp;				throw utils.throwNullIdentifierException(trObj);</b>
<i>268</i>&nbsp;			}
<i>269</i>&nbsp;		}
<i>270</i>&nbsp;
<i>271</i>&nbsp;		// Retrieve the persistent object from the database
<b class="fc"><i>272</i>&nbsp;		T dbObj = (T) utils.find(utils.getClass(trObj), identifier);</b>
<b class="fc"><i>273</i>&nbsp;		if (dbObj == null) {</b>
<i>274</i>&nbsp;			// Throw an exception indicating that the persistent object cannot be retrieved.
<b class="fc"><i>275</i>&nbsp;			throw utils.throwEntityNotFoundException(identifier, trObj);</b>
<i>276</i>&nbsp;		}
<i>277</i>&nbsp;
<b class="fc"><i>278</i>&nbsp;		return merge_(trObj, dbObj, tree);</b>
<i>279</i>&nbsp;	}
<i>280</i>&nbsp;
<i>281</i>&nbsp;	/**
<i>282</i>&nbsp;	 * Invokes the given {@link EntityCallback} and passes its result to {@link #merge(Object, Object)}.
<i>283</i>&nbsp;	 *
<i>284</i>&nbsp;	 * @param trObj    the object to merge
<i>285</i>&nbsp;	 * @param callback the callback to execute
<i>286</i>&nbsp;	 * @return the merged object
<i>287</i>&nbsp;	 * @see #merge(Object, Object)
<i>288</i>&nbsp;	 */
<i>289</i>&nbsp;	@Nullable
<i>290</i>&nbsp;	public final &lt;T&gt; T merge(@Nullable T trObj, @Nonnull EntityCallback&lt;T, PU, PC, PMD&gt; callback) {
<b class="fc"><i>291</i>&nbsp;		T dbObj = trObj == null ? null : callback.&lt;T&gt;work(persistenceUnitProvider);</b>
<b class="fc"><i>292</i>&nbsp;		return merge(trObj, dbObj);</b>
<i>293</i>&nbsp;	}
<i>294</i>&nbsp;
<i>295</i>&nbsp;	@Nullable
<i>296</i>&nbsp;	@Override
<i>297</i>&nbsp;	public final &lt;T&gt; T merge(@Nullable T trObj, @Nullable T dbObj) {
<b class="fc"><i>298</i>&nbsp;		return merge_(trObj, dbObj, createAdjacencyMap());</b>
<i>299</i>&nbsp;	}
<i>300</i>&nbsp;
<i>301</i>&nbsp;	@Nullable
<i>302</i>&nbsp;	@Override
<i>303</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>304</i>&nbsp;	public &lt;T&gt; T merge_(@Nullable T trObj, @Nullable T dbObj, @Nonnull Map&lt;Object, Object&gt; tree) {
<i>305</i>&nbsp;		// Check if the object has already been processed
<b class="fc"><i>306</i>&nbsp;		if (tree.containsKey(trObj) || dbObj == null) {</b>
<b class="fc"><i>307</i>&nbsp;			return (T) tree.get(trObj);</b>
<i>308</i>&nbsp;		}
<i>309</i>&nbsp;
<i>310</i>&nbsp;		// Use an EntityPersister if possible
<b class="fc"><i>311</i>&nbsp;		AbstractEntityPersister&lt;T&gt; entityPersister = getEntityPersister(trObj != null ? (Class&lt;? extends T&gt;) trObj.getClass() : null);</b>
<b class="fc"><i>312</i>&nbsp;		if (entityPersister != null) {</b>
<b class="fc"><i>313</i>&nbsp;			if (logger.isDebugEnabled()) {</b>
<b class="fc"><i>314</i>&nbsp;				logger.debug(String.format(&quot;Using %s for %s&quot;, entityPersister.getClass().getSimpleName(), trObj));</b>
<i>315</i>&nbsp;			}
<b class="fc"><i>316</i>&nbsp;			return entityPersister.merge_(trObj, dbObj, tree);</b>
<i>317</i>&nbsp;		}
<i>318</i>&nbsp;
<i>319</i>&nbsp;		// Add the object to the adjacency list
<b class="fc"><i>320</i>&nbsp;		tree.put(trObj, dbObj);</b>
<i>321</i>&nbsp;
<i>322</i>&nbsp;		// Verify that the given object is a non-null managed entity or it is not necessary to merge it
<b class="fc"><i>323</i>&nbsp;		PMD metadata = utils.getMetadata(trObj);</b>
<b class="fc"><i>324</i>&nbsp;		if (metadata == null || trObj == dbObj) {</b>
<b class="fc"><i>325</i>&nbsp;			return trObj;</b>
<i>326</i>&nbsp;		}
<i>327</i>&nbsp;
<i>328</i>&nbsp;		// Retrieve the identifier of the persistent object
<b class="fc"><i>329</i>&nbsp;		Serializable identifier = utils.getIdentifierValue(metadata, dbObj);</b>
<i>330</i>&nbsp;
<i>331</i>&nbsp;		// Compare the version property (if present and enabled)
<b class="fc"><i>332</i>&nbsp;		PropertyAccessor dbPropertyAccessor = utils.getPropertyAccessor(metadata, dbObj);</b>
<b class="fc"><i>333</i>&nbsp;		PropertyAccessor trPropertyAccessor = utils.getPropertyAccessor(metadata, trObj);</b>
<b class="fc"><i>334</i>&nbsp;		String[] propertyNames = utils.getPropertyNames(trObj);</b>
<b class="fc"><i>335</i>&nbsp;		if (config.getCheckVersion() &amp;&amp; utils.isVersioned(metadata)) {</b>
<b class="fc"><i>336</i>&nbsp;			Object dbValue = dbPropertyAccessor.getPropertyValue(utils.getVersionPropertyName(metadata));</b>
<b class="fc"><i>337</i>&nbsp;			Object trValue = trPropertyAccessor.getPropertyValue(utils.getVersionPropertyName(metadata));</b>
<b class="fc"><i>338</i>&nbsp;			if (dbValue != null &amp;&amp; !dbValue.equals(trValue)) {</b>
<b class="fc"><i>339</i>&nbsp;				throw utils.throwOptimisticLockException(dbValue, identifier);</b>
<i>340</i>&nbsp;			}
<i>341</i>&nbsp;		}
<i>342</i>&nbsp;
<i>343</i>&nbsp;		// Process the properties
<b class="fc"><i>344</i>&nbsp;		for (int i = 0; i &lt; propertyNames.length; i++) {</b>
<b class="fc"><i>345</i>&nbsp;			String propertyName = propertyNames[i];</b>
<i>346</i>&nbsp;			// Skip transient properties
<b class="fc"><i>347</i>&nbsp;			if (utils.isTransient(dbObj, propertyName)) {</b>
<b class="fc"><i>348</i>&nbsp;				continue;</b>
<i>349</i>&nbsp;			}
<i>350</i>&nbsp;
<i>351</i>&nbsp;			// Do not apply the version property if version checking is enabled
<b class="fc"><i>352</i>&nbsp;			String versionPropertyName = utils.getVersionPropertyName(metadata);</b>
<b class="fc"><i>353</i>&nbsp;			if (propertyName.equals(versionPropertyName) &amp;&amp; config.getCheckVersion()) {</b>
<b class="fc"><i>354</i>&nbsp;				continue;</b>
<i>355</i>&nbsp;			}
<i>356</i>&nbsp;
<i>357</i>&nbsp;			// Read the property values
<b class="fc"><i>358</i>&nbsp;			Object trValue = trPropertyAccessor.getPropertyValue(propertyName);</b>
<b class="fc"><i>359</i>&nbsp;			Object dbValue = dbPropertyAccessor.getPropertyValue(propertyName);</b>
<b class="fc"><i>360</i>&nbsp;			Class&lt;?&gt; type = utils.getPropertyType(utils.getClass(dbObj), propertyName);</b>
<i>361</i>&nbsp;
<i>362</i>&nbsp;			// Lazily loaded collections are not copied
<b class="fc"><i>363</i>&nbsp;			if (Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) {</b>
<b class="fc"><i>364</i>&nbsp;				if (!utils.isInitializedPersistentCollection(dbValue)) {</b>
<i>365</i>&nbsp;					// If property is loaded lazily, the value of the given object must be null or empty
<b class="fc"><i>366</i>&nbsp;					if (trValue != null &amp;&amp; trValue != dbValue &amp;&amp; CollectionUtils.size(trValue) &gt; 0) {</b>
<b class="fc"><i>367</i>&nbsp;						throw utils.throwLazyPropertyNotNullException(trValue, dbObj, propertyName);</b>
<i>368</i>&nbsp;					}
<i>369</i>&nbsp;					continue;
<i>370</i>&nbsp;				}
<b class="fc"><i>371</i>&nbsp;				trValue = merge_(trValue, dbValue, tree);</b>
<i>372</i>&nbsp;			}
<i>373</i>&nbsp;
<i>374</i>&nbsp;			// Lazily loaded properties are not copied
<b class="fc"><i>375</i>&nbsp;			if (!ClassUtils.isPrimitiveOrWrapper(type) &amp;&amp; !type.getName().startsWith(&quot;java.&quot;) &amp;&amp; !type.isArray()) {</b>
<i>376</i>&nbsp;				// If the persistent value is a Hibernate proxy, it might be loaded lazily
<b class="fc"><i>377</i>&nbsp;				if (utils.isProxy(dbValue)) {</b>
<b class="fc"><i>378</i>&nbsp;					if (utils.isUninitialized(propertyName, dbObj, dbValue, trValue)) {</b>
<b class="nc"><i>379</i>&nbsp;						continue;</b>
<i>380</i>&nbsp;					}
<b class="fc"><i>381</i>&nbsp;				} else if (trValue != dbValue) {</b>
<i>382</i>&nbsp;					// Get the identifier of the associated transient object
<b class="fc"><i>383</i>&nbsp;					PMD valueMetadata = utils.getMetadata(dbValue);</b>
<b class="fc"><i>384</i>&nbsp;					Serializable trValueId = Serializable.class.cast(utils.getIdentifier(valueMetadata, trValue));</b>
<i>385</i>&nbsp;					// Get the identifier of the associated persistent object
<b class="fc"><i>386</i>&nbsp;					Serializable dbValueId = Serializable.class.cast(utils.getIdentifier(valueMetadata, dbValue));</b>
<i>387</i>&nbsp;
<i>388</i>&nbsp;					// If the transient object is new
<b class="fc"><i>389</i>&nbsp;					if (trValueId == null) {</b>
<b class="nc"><i>390</i>&nbsp;						if (config.getSaveNewEntities()) {</b>
<i>391</i>&nbsp;							// If desired, try to persist the object
<b class="nc"><i>392</i>&nbsp;							trValueId = utils.persist(trValue);</b>
<b class="nc"><i>393</i>&nbsp;							trValue = utils.find(trValue.getClass(), trValueId);</b>
<i>394</i>&nbsp;						} else {
<i>395</i>&nbsp;							// Otherwise throw an exception indicating that the entity should have been saved before
<b class="nc"><i>396</i>&nbsp;							throw utils.throwUnsavedTransientInstanceException(trValue);</b>
<i>397</i>&nbsp;						}
<b class="fc"><i>398</i>&nbsp;					} else if (!trValueId.equals(dbValueId)) {</b>
<i>399</i>&nbsp;						// Load the entity with the given identifier
<b class="nc"><i>400</i>&nbsp;						trValue = utils.find(dbValue.getClass(), trValueId);</b>
<i>401</i>&nbsp;					} else {
<i>402</i>&nbsp;						// Use the persistent value because the object identities are equals
<b class="fc"><i>403</i>&nbsp;						trValue = dbValue;</b>
<i>404</i>&nbsp;					}
<i>405</i>&nbsp;				}
<i>406</i>&nbsp;			}
<i>407</i>&nbsp;
<b class="fc"><i>408</i>&nbsp;			if (trValue != dbValue) {</b>
<b class="fc"><i>409</i>&nbsp;				if (logger.isTraceEnabled()) {</b>
<b class="fc"><i>410</i>&nbsp;					logger.trace(String.format(&quot;Setting property %s of %s to %s&quot;, propertyName, dbObj, trValue));</b>
<i>411</i>&nbsp;				}
<b class="fc"><i>412</i>&nbsp;				dbPropertyAccessor.setPropertyValue(propertyName, trValue);</b>
<i>413</i>&nbsp;			}
<i>414</i>&nbsp;		}
<i>415</i>&nbsp;
<b class="fc"><i>416</i>&nbsp;		return dbObj;</b>
<i>417</i>&nbsp;	}
<i>418</i>&nbsp;
<i>419</i>&nbsp;	/**
<i>420</i>&nbsp;	 * Returns the {@code EntityPersisterConfiguration} that should be used.
<i>421</i>&nbsp;	 *
<i>422</i>&nbsp;	 * @return the {@code EntityPersisterConfiguration} to use
<i>423</i>&nbsp;	 */
<i>424</i>&nbsp;	@Nonnull
<i>425</i>&nbsp;	public EntityPersisterConfiguration getConfig() {
<b class="fc"><i>426</i>&nbsp;		return config;</b>
<i>427</i>&nbsp;	}
<i>428</i>&nbsp;
<i>429</i>&nbsp;	/**
<i>430</i>&nbsp;	 * Sets the {@code EntityPersisterConfiguration} that should be used.
<i>431</i>&nbsp;	 *
<i>432</i>&nbsp;	 * @param config the {@code EntityPersisterConfiguration} to use
<i>433</i>&nbsp;	 */
<i>434</i>&nbsp;	public void setConfig(@Nonnull EntityPersisterConfiguration config) {
<b class="fc"><i>435</i>&nbsp;		this.config = config;</b>
<b class="fc"><i>436</i>&nbsp;	}</b>
<i>437</i>&nbsp;
<i>438</i>&nbsp;	/**
<i>439</i>&nbsp;	 * Sets a flag indicating that the default {@link EntityPersister}s should be initialized upon initialization.
<i>440</i>&nbsp;	 *
<i>441</i>&nbsp;	 * @param registerDefaultEntityPersisters
<i>442</i>&nbsp;	 *         {@code true} if the default {@code EntityPersister}s should be registered, {@code false} otherwise
<i>443</i>&nbsp;	 */
<i>444</i>&nbsp;	public void setRegisterDefaultEntityPersisters(boolean registerDefaultEntityPersisters) {
<b class="nc"><i>445</i>&nbsp;		this.registerDefaultEntityPersisters = registerDefaultEntityPersisters;</b>
<b class="nc"><i>446</i>&nbsp;	}</b>
<i>447</i>&nbsp;
<i>448</i>&nbsp;	/**
<i>449</i>&nbsp;	 * Returns a modifiable map containing all registered {@code EntityPersister}s.
<i>450</i>&nbsp;	 *
<i>451</i>&nbsp;	 * @return the registered {@code EntityPersister}s
<i>452</i>&nbsp;	 */
<i>453</i>&nbsp;	@Nonnull
<i>454</i>&nbsp;	public Map&lt;Class&lt;?&gt;, AbstractEntityPersister&lt;?&gt;&gt; getPersisterMap() {
<b class="fc"><i>455</i>&nbsp;		if (persisterMap == null) {</b>
<b class="fc"><i>456</i>&nbsp;			persisterMap = new LinkedHashMap&lt;Class&lt;?&gt;, AbstractEntityPersister&lt;?&gt;&gt;();</b>
<i>457</i>&nbsp;		}
<b class="fc"><i>458</i>&nbsp;		return persisterMap;</b>
<i>459</i>&nbsp;	}
<i>460</i>&nbsp;
<i>461</i>&nbsp;	/**
<i>462</i>&nbsp;	 * Sets the mapping of the {@code AbstractEntityPersister}s that should be used.
<i>463</i>&nbsp;	 *
<i>464</i>&nbsp;	 * @param persisterMap the entity persister mapping
<i>465</i>&nbsp;	 */
<i>466</i>&nbsp;	public void setPersisterMap(@Nonnull Map&lt;Class&lt;?&gt;, AbstractEntityPersister&lt;?&gt;&gt; persisterMap) {
<b class="nc"><i>467</i>&nbsp;		this.persisterMap = persisterMap;</b>
<b class="nc"><i>468</i>&nbsp;	}</b>
<i>469</i>&nbsp;
<i>470</i>&nbsp;	/**
<i>471</i>&nbsp;	 * Returns an {@link EntityPersister} that is capable of processing instances
<i>472</i>&nbsp;	 * of the given type.
<i>473</i>&nbsp;	 *
<i>474</i>&nbsp;	 * @param clazz the type of the object to process
<i>475</i>&nbsp;	 * @return the EntityPersister or {@code null} if there is none available.
<i>476</i>&nbsp;	 */
<i>477</i>&nbsp;	@Nullable
<i>478</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>479</i>&nbsp;	public &lt;T&gt; AbstractEntityPersister&lt;T&gt; getEntityPersister(@Nullable Class&lt;? extends T&gt; clazz) {
<b class="fc"><i>480</i>&nbsp;		AbstractEntityPersister&lt;T&gt; entityPersister = (AbstractEntityPersister&lt;T&gt;) getPersisterMap().get(clazz);</b>
<b class="fc"><i>481</i>&nbsp;		if (entityPersister == null &amp;&amp; clazz != null &amp;&amp; !getPersisterMap().containsKey(clazz)) {</b>
<b class="fc"><i>482</i>&nbsp;			entityPersister = findEntityPersister(clazz);</b>
<i>483</i>&nbsp;
<b class="fc"><i>484</i>&nbsp;			if (entityPersister == null) {</b>
<b class="fc"><i>485</i>&nbsp;				for (Map.Entry&lt;Class&lt;?&gt;, AbstractEntityPersister&lt;?&gt;&gt; entry : persisterMap.entrySet()) {</b>
<b class="fc"><i>486</i>&nbsp;					if (entry.getValue() instanceof DynamicEntityPersister) {</b>
<b class="fc"><i>487</i>&nbsp;						if (((DynamicEntityPersister&lt;?&gt;) entry.getValue()).supports(clazz)) {</b>
<b class="fc"><i>488</i>&nbsp;							entityPersister = (AbstractEntityPersister&lt;T&gt;) entry.getValue();</b>
<b class="fc"><i>489</i>&nbsp;							break;</b>
<i>490</i>&nbsp;						}
<i>491</i>&nbsp;					}
<b class="fc"><i>492</i>&nbsp;				}</b>
<i>493</i>&nbsp;			}
<b class="fc"><i>494</i>&nbsp;			if (logger.isDebugEnabled()) {</b>
<b class="fc"><i>495</i>&nbsp;				logger.trace(String.format(&quot;Registering %s for type %s&quot;, entityPersister, clazz.getName()));</b>
<i>496</i>&nbsp;			}
<b class="fc"><i>497</i>&nbsp;			getPersisterMap().put(clazz, entityPersister);</b>
<i>498</i>&nbsp;		}
<b class="fc"><i>499</i>&nbsp;		return entityPersister;</b>
<i>500</i>&nbsp;	}
<i>501</i>&nbsp;
<i>502</i>&nbsp;	@Nullable
<i>503</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>504</i>&nbsp;	private &lt;T&gt; AbstractEntityPersister&lt;T&gt; findEntityPersister(@Nonnull Class&lt;? extends T&gt; clazz) {
<i>505</i>&nbsp;		try {
<b class="fc"><i>506</i>&nbsp;			for (Map.Entry&lt;Class&lt;?&gt;, AbstractEntityPersister&lt;?&gt;&gt; entry : getPersisterMap().entrySet()) {</b>
<b class="fc"><i>507</i>&nbsp;				if (entry.getKey().isAssignableFrom(clazz)) {</b>
<b class="fc"><i>508</i>&nbsp;					return (AbstractEntityPersister&lt;T&gt;) entry.getValue();</b>
<i>509</i>&nbsp;				}
<b class="fc"><i>510</i>&nbsp;			}</b>
<b class="nc"><i>511</i>&nbsp;		} catch (ConcurrentModificationException e) {</b>
<i>512</i>&nbsp;			/*
<i>513</i>&nbsp;			 * The persister map is not synchronized because of the performance requirements.
<i>514</i>&nbsp;			 * Thus, a ConcurrentModificationException may rarely happen while iterating through it.
<i>515</i>&nbsp;			 * Therefore, the exception is ignored and Dormancy attempts to retry finding an appropriate EntityPersister.
<i>516</i>&nbsp;			 */
<b class="nc"><i>517</i>&nbsp;			return findEntityPersister(clazz);</b>
<b class="fc"><i>518</i>&nbsp;		}</b>
<b class="fc"><i>519</i>&nbsp;		return null;</b>
<i>520</i>&nbsp;	}
<i>521</i>&nbsp;
<i>522</i>&nbsp;	@Override
<i>523</i>&nbsp;	@SuppressWarnings(&quot;unchecked&quot;)
<i>524</i>&nbsp;	public void setApplicationContext(@Nonnull ApplicationContext applicationContext) {
<b class="fc"><i>525</i>&nbsp;		Map&lt;String, AbstractDormancyUtils&gt; utilsMap = applicationContext.getBeansOfType(AbstractDormancyUtils.class);</b>
<b class="fc"><i>526</i>&nbsp;		if (utilsMap.size() &gt; 1) {</b>
<b class="nc"><i>527</i>&nbsp;			throw new IllegalStateException(String.format(&quot;Cannot initialize %s: Multiple beans of type %s found: %s&quot;,</b>
<i>528</i>&nbsp;					getClass(), AbstractDormancyUtils.class.getName(), utilsMap.keySet()));
<b class="fc"><i>529</i>&nbsp;		} else if (utilsMap.size() == 1) {</b>
<b class="nc"><i>530</i>&nbsp;			this.utils = utilsMap.get(utilsMap.keySet().iterator().next());</b>
<i>531</i>&nbsp;		}
<i>532</i>&nbsp;
<b class="fc"><i>533</i>&nbsp;		initialize();</b>
<i>534</i>&nbsp;		// Retrieve all AbstractEntityPersisters from the application context and register them
<b class="fc"><i>535</i>&nbsp;		Map&lt;String, AbstractEntityPersister&gt; map = applicationContext.getBeansOfType(AbstractEntityPersister.class);</b>
<b class="fc"><i>536</i>&nbsp;		for (AbstractEntityPersister&lt;?&gt; entityPersister : map.values()) {</b>
<b class="fc"><i>537</i>&nbsp;			addEntityPersister(entityPersister);</b>
<b class="fc"><i>538</i>&nbsp;		}</b>
<b class="fc"><i>539</i>&nbsp;	}</b>
<i>540</i>&nbsp;
<i>541</i>&nbsp;	/**
<i>542</i>&nbsp;	 * Registers the given {@link AbstractEntityPersister} for certain types.&lt;br/&gt;
<i>543</i>&nbsp;	 * The {@link AbstractEntityPersister} is registered for every type returned by
<i>544</i>&nbsp;	 * {@link AbstractEntityPersister#getSupportedTypes()} and the parameter types.
<i>545</i>&nbsp;	 * Furthermore, the type of the {@link AbstractEntityPersister} itself is registered so it can be used by in
<i>546</i>&nbsp;	 * {@link at.dormancy.aop.PersistenceEndpoint#types()}.
<i>547</i>&nbsp;	 *
<i>548</i>&nbsp;	 * @param entityPersister the EntityPersister to register
<i>549</i>&nbsp;	 * @param types           the types of objects supported by the EntityPersister (may be {@code null})
<i>550</i>&nbsp;	 * @see #addEntityPersister(Class, Class[])
<i>551</i>&nbsp;	 */
<i>552</i>&nbsp;	public void addEntityPersister(@Nonnull AbstractEntityPersister&lt;?&gt; entityPersister, @Nullable Class&lt;?&gt;... types) {
<b class="fc"><i>553</i>&nbsp;		if (CollectionUtils.isNotEmpty(entityPersister.getSupportedTypes())) {</b>
<b class="fc"><i>554</i>&nbsp;			for (Class&lt;?&gt; type : entityPersister.getSupportedTypes()) {</b>
<b class="fc"><i>555</i>&nbsp;				getPersisterMap().put(type, entityPersister);</b>
<b class="fc"><i>556</i>&nbsp;			}</b>
<i>557</i>&nbsp;		}
<b class="fc"><i>558</i>&nbsp;		if (ArrayUtils.isNotEmpty(types)) {</b>
<i>559</i>&nbsp;			// Register the given types for advanced customization
<b class="fc"><i>560</i>&nbsp;			for (Class&lt;?&gt; type : types) {</b>
<b class="fc"><i>561</i>&nbsp;				getPersisterMap().put(type, entityPersister);</b>
<i>562</i>&nbsp;			}
<i>563</i>&nbsp;		}
<i>564</i>&nbsp;		// Register the unproxified persister itself to make it available for PersistenceEndpoint
<b class="fc"><i>565</i>&nbsp;		getPersisterMap().put(AopUtils.getTargetClass(entityPersister), entityPersister);</b>
<b class="fc"><i>566</i>&nbsp;	}</b>
<i>567</i>&nbsp;
<i>568</i>&nbsp;	/**
<i>569</i>&nbsp;	 * Registers an instance of the given {@link AbstractEntityPersister} type for certain types.&lt;br/&gt;
<i>570</i>&nbsp;	 * The {@link AbstractEntityPersister} is registered for every type returned by
<i>571</i>&nbsp;	 * {@link AbstractEntityPersister#getSupportedTypes()} and the parameter types.
<i>572</i>&nbsp;	 * Furthermore, the type of the {@link AbstractEntityPersister} itself is registered so it can be used by in
<i>573</i>&nbsp;	 * {@link at.dormancy.aop.PersistenceEndpoint#types()}.
<i>574</i>&nbsp;	 *
<i>575</i>&nbsp;	 * @param entityPersisterClass the type of the EntityPersister to register
<i>576</i>&nbsp;	 * @param types                the types of objects supported by the EntityPersister (may be {@code null})
<i>577</i>&nbsp;	 * @see #addEntityPersister(AbstractEntityPersister, Class[])
<i>578</i>&nbsp;	 */
<i>579</i>&nbsp;	public void addEntityPersister(@Nonnull Class&lt;? extends AbstractEntityPersister&gt; entityPersisterClass, @Nullable Class&lt;?&gt;... types) {
<b class="fc"><i>580</i>&nbsp;		Constructor&lt;? extends AbstractEntityPersister&gt; constructor = ClassUtils.getConstructorIfAvailable(entityPersisterClass, Dormancy.class);</b>
<b class="fc"><i>581</i>&nbsp;		AbstractEntityPersister&lt;?&gt; entityPersister = constructor != null ? BeanUtils.instantiateClass(constructor, this) : BeanUtils.instantiateClass(entityPersisterClass);</b>
<b class="fc"><i>582</i>&nbsp;		if (entityPersister instanceof AbstractContainerPersister) {</b>
<b class="fc"><i>583</i>&nbsp;			((AbstractContainerPersister&lt;?&gt;) entityPersister).setPersistentUnitProvider(persistenceUnitProvider);</b>
<i>584</i>&nbsp;		}
<b class="fc"><i>585</i>&nbsp;		addEntityPersister(entityPersister, types);</b>
<b class="fc"><i>586</i>&nbsp;	}</b>
<i>587</i>&nbsp;
<i>588</i>&nbsp;	/**
<i>589</i>&nbsp;	 * Returns the Dormancy utilities associated with this instance.
<i>590</i>&nbsp;	 *
<i>591</i>&nbsp;	 * @return the Dormancy utilities to use
<i>592</i>&nbsp;	 */
<i>593</i>&nbsp;	@Nonnull
<i>594</i>&nbsp;	public AbstractDormancyUtils&lt;PU, PC, PMD, PersistenceUnitProvider&lt;PU, PC, PMD&gt;&gt; getUtils() {
<b class="fc"><i>595</i>&nbsp;		return utils;</b>
<i>596</i>&nbsp;	}
<i>597</i>&nbsp;}
</div>
</div>

<div class="footer">
    
    <div style="float:right;">generated on 2013-07-31 23:31</div>
</div>
</body>
</html>
